package com.dwms.feign.system;

import com.dwms.entity.PageResponse;
import com.dwms.entity.QueryRequest;
import com.dwms.entity.Request;
import com.dwms.entity.Result;
import com.dwms.entity.system.dept.request.DeptQueryRequest;
import com.dwms.entity.system.dept.request.DeptRequest;
import com.dwms.entity.system.dept.response.DeptResponse;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.List;

/**
 * @ClassName: DeptMapper
 * @Description: Dept
 * @Create 2022/03/05 20:46
 * @Author WH
 * @Since 2.0.0
**/
@FeignClient(value = "system-server",path = "/dept")
public interface DeptFeignClient {

    /**
     * 新增部门
     * @param deptRequest
     * @return
     */
    @PostMapping("/save")
    Result save(@RequestBody DeptRequest deptRequest);

    /**
     * 修改部门
     * @param deptRequest
     * @return
     */
    @PostMapping("/update")
    Result update(@RequestBody DeptRequest deptRequest);

    /**
     *  分页查询部门
     * @param query
     * @return
     */
    @PostMapping("/findPage")
    Result<PageResponse<DeptResponse>> findPage(@RequestBody DeptQueryRequest query);

    /**
     * 根据ID查询部门
     * @param query
     * @return
     */
    @PostMapping("/findById")
    Result findById(@RequestBody QueryRequest query);

    /**
     * 删除部门
     * @param query
     * @return
     */
    @PostMapping("/delete")
    Result delete(@RequestBody QueryRequest query);

    /**
     * 查询部门树形结构
     * @return
     */
    @PostMapping("/findTree")
    Result<List<DeptResponse>> findTree(Request request);

    /**
     * 修改状态
     * @param query
     * @return
     */
    @PostMapping("/updateStatus")
    Result updateStatus(@RequestBody QueryRequest query);
}
